<link rel="stylesheet" type="text/css" href="/css/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="/css/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/css/admin.css">
<link rel="stylesheet" href="/component/layui/css/layui.css" media="all">
<script type="text/javascript" src="/js/jquery-2.1.4.min.js"></script>
<script src="/component/layui/layui.js"></script>
<script type="text/javascript" src="/css/easyui/jquery.easyui.min.js"></script>
<style>
   TD {FONT-SIZE: 14px;} a:link{color:#33aaff;text-decoration:underline ;}a:hover {color:#6bc1ff}
</style>
<div class="container" style="width: 100%;height: 100%;overflow: auto;">
	<table style="margin-top: 5px;margin-left: 5px;">
			<tbody><tr>
				<!-- <a href="reportexport?name={{$name}}{!! !empty($categoryId)?'&categoryId='.$categoryId:'' !!}" id="print" class="easyui-linkbutton l-btn l-btn-small l-btn-plain" data-options="iconCls:'icon-print',plain:true" group=""><span class=""><span class="l-btn-text">导出</span></span></a> -->
				<td style="width: 70px; height: 15px">
					<a id="btnexport">导  出</a>
				</td>
				{{--<td><a href="#" onclick="Func_Add_QY()" id="addcompany" class="easyui-linkbutton l-btn l-btn-small l-btn-plain" data-options="iconCls:'icon-add',plain:true" group=""><span class=""><span class="">&nbsp;</span></span></a></td>--}}
				<td style="width: 90px; height: 25px"><strong>单位名称：</strong></td>
				<form action="" method="get" id="actionForm">
					<input type="hidden" name="level" value="{!! !empty($_GET['level'])?$_GET['level']:''!!}">
					<input type="hidden" name="city" value="{!! !empty($_GET['city'])?$_GET['city']:''!!}">
					<td height="15">
						<input style="height: 27px" name="name" type="text" id="name" size="20">
						<strong style="margin-left: 3px;">单位分类：</strong>
						<select style="height: 27px" name="categoryId" id="search_type">
							<option value="">全部</option>
							@foreach ($categorys as $category)
								<option value="{{ $category->id }}">{{ $category->name }}</option>
							@endforeach
						</select>
					</td>
					<td height="15">
						<strong style="margin-left: 12px;">整改状态：</strong>
						<select style="height: 27px" name="checkstatus">
							<option value="0">全部</option>
							<option value="1">整改中</option>
							<option value="2">正常</option>
						</select>
					</td>
					<td height="15" style="display: flex;flex-direction: row;justify-content: center;height: 30px;align-items: center;">
						<strong style="margin-left: 12px;width:120px;">检查时间：</strong>
						<input type="text" class="layui-input" id="test1" name="checkdate" value="{{isset($_GET['checkdate'])?$_GET['checkdate']:''}}">
					</td>
					<td style="width: 80px; height: 15px;padding-left: 5px;">
						<a id="btn" href="javascript:void(0);">搜  索</a>
					</td>
				</form>
			</tr>
			</tbody></table>
	
	
		<div class="tubiaof">{{$cityname}}隐患排查清单（<a href="/admin/work/checkchartcontent" target="_blank" 
		style = "text-align: center;
			font-size: 30px;
			line-height: 50px;
			height: 50px;
			margin: 30px 0" >汇总分析</a>）</div>
	
		<div data-options="region:'center',title:'center title'" style="background:#E0ECFF;">
			<table class="am-table am-table-bd am-top">
				<thead><tr><th>网 格</th>
					<th>监管单位数量</th>
					<th>实际检查单位数量</th>
					<th>查出隐患数量</th>
					<th>整改隐患数量</th>
					<th>未整改隐患数量</th>
					<th>整改比例</th>
				</tr></thead>
				<tbody>
				@foreach($dataarr as $da)
					<tr>
						<td>{{$da['product']}}</td>
						<td>{{$da['comnum']}}</td>
						<td>{{$da['checknum']}}</td>
						<td>{{$da['deangernum']}}</td>
						<td>{{$da['againnum']}}</td>
						<td>{{$da['unagainnum']}}</td>
						<td>{{$da['percent']}}</td>
					</tr>
				@endforeach
				</tbody>
			</table>
		</div>
	
		{{--<div id="content" class="easyui-panel" style="height:600px">--}}
		<table class="am-table am-table-bd" style="margin-top: 20px">
			<thead><tr class="table-tr">
			<td>序  号</td>
			<td>名  称</td>
			<td>标  签</td>
			<td>人  数</td>
			<td>地  址</td>
			<td>分  类</td>
			<td>检查日期</td>
			<td>是否存在隐患</td>
			<td>整改状态</td>
			<td>操  作</td></tr></thead>
			<tbody>
			<?php $i=1;?>
			@foreach ($companys as $company)
				<?php $set = 0;?>
				@foreach($comcheckdetail as $com)
				@if($com->checkId == $company->checkId && $com->status ==2) 
				<?php $set = 1;?>
				@endif 
				@endforeach
				<tr><td>{{$i}}</td><td>{{ $company->comName }}</td>
					<td>
						<?php
							$str='';
							if($company->tagrelations && count($company->tagrelations)>0){
								foreach($company->tagrelations as $t){
									$str.=$t->taginfo->tag_name.'<br>';
								}
							}
							echo $str;
						?>
						
					</td>
					<td>{{$company->workersNum}}</td><td>@foreach ($area as $a){!! !empty($company->district)&&$company->district == $a->id ? $a->name: '' !!}{!! !empty($company->street)&&$company->street == $a->id ? $a->name: '' !!} {!! !empty($company->community)&&$company->community == $a->id ? $a->name: '' !!}
						@endforeach{{$company->address or ''}}</td>
					<td>@foreach($categorys as $category)
							{!! !empty($company->categoryId)&&$company->categoryId == $category->id ? $category->name: '' !!}
						@endforeach</td>
					<td>{{$company->created}}</td>
					<td style="color: {!! $set?'red':'black' !!}">{!! $set?'是':'否' !!}</td>
					<td>{!! $set?'整改中':'正常' !!}</td>
					<td><a href="reportones?id={{$company->id}}">查 看</a></td></tr>
				<?php $i+=1;?>
			@endforeach
			</tbody>
		</table>
		{{--</div>--}}
		<div class="chunshes" style="margin-top: 40px;margin-bottom: 40px;margin-left: 30%;">
	
			{{--{{ $companys->links() }}--}}
			@if($companys->total()> 8)
			@if($companys->previousPageUrl())
			<a href="{{$companys->previousPageUrl()}}&level={!! !empty($_GET['level'])?$_GET['level']:''!!}&city={!! !empty($_GET['city'])?$_GET['city']:''!!}&checkstatus={!! !empty($_GET['checkstatus'])?$_GET['checkstatus']:''!!}&checkdate={!! !empty($_GET['checkdate'])?$_GET['checkdate']:''!!}" target="myFrameName" style="text-decoration:none;">上一页</a>
			@endif
			@if($companys->nextPageUrl())
			<a href="{{$companys->nextPageUrl()}}&level={!! !empty($_GET['level'])?$_GET['level']:''!!}&city={!! !empty($_GET['city'])?$_GET['city']:''!!}&checkstatus={!! !empty($_GET['checkstatus'])?$_GET['checkstatus']:''!!}&checkdate={!! !empty($_GET['checkdate'])?$_GET['checkdate']:''!!}" target="myFrameName" style="text-decoration:none;">下一页</a>第{{$companys->currentPage()}}页，
			@endif
			@endif
			<!-- <div id="pages"></div> -->
			共{{$companys->lastPage()}}页，当前显示{{$companys->firstItem()}}-{{$companys->lastItem()}}条记录，共{{$companys->total()}}条记录
		</div>
</div>
<script>
layui.use(['laydate','laypage'], function(){
  var laydate = layui.laydate;
  var laypage = layui.laypage;
    
    //执行一个laypage实例
    laypage.render({
      elem: 'pages' //注意，这里的 test1 是 ID，不用加 # 号
      ,count: {{$companys->total()}},
	  limit:8
    });
  
  laydate.render({ 
    elem: '#test1'
    ,type: 'date'
    ,range: true
  });
});
</script>
<script>
    $('#btn').linkbutton({
        iconCls: 'icon-search'
    });
    $('#btn').click(function(){
        $('#actionForm').submit();
    });
    $('#btnexport').linkbutton({
        iconCls: 'icon-save'
    });
	layui.use(['form','laydate','layer'], function() {
		var form = layui.form;
		var layer = layui.layer;
		var laydate = layui.laydate;
		
		
		
		$('#btnexport').on('click',function(){
			// var index = layer.load(0, { shade: false })
			layer.open({
			  title: '导出提示'
			  ,content: '文件正在导出中，请稍后...'
			});     
			window.location.href="reportexport?{!! !empty($_GET['name'])?'name='.$_GET['name']:'name=' !!}{!! !empty($_GET['categoryId'])?'&categoryId='.$_GET['categoryId']:'&categoryId=' !!}{!! !empty($_GET['level'])?'&level='.$_GET['level']:'&level=' !!}{!! !empty($_GET['city'])?'&city='.$_GET['city']:'&city=' !!}"
		})
	})
		

</script>

